### Language extensions for convenience ###

# 2
class String	# 3: just wrap the definition with 'class String'
	def string_blank?	# renamed to avoid conflicts with (4) below
		self.nil? || self.empty?
	end
end

# 4
# By defining blank? in the Object class, any object should respond
# to it, since all Ruby objects are subclasses of Object and inherit
# its methods.
class Object
	def blank?
		if self.respond_to? :empty?
			self.empty? || ( (self.respond_to? :lstrip) && self.lstrip.empty?)
		else
			self.nil?
		end
	end
end

# a bit of test code...
# this should be true (i.e. "", nil, (), and {} should all be blank)
"".blank?
nil.blank?
[].blank?
{}.blank?

# these should not be blank
1.blank?
"hai".blank?
[1,2,3].blank?
{"foo", "bar"}.blank?
